Distributed Shared Caching for Clustered File Systems

ABSTRACT

Systems and methods for distributed shared caching in a clustered file system, wherein coordination between the distributed caches, their coherency and concurrency management, are all done based on the granularity of data segments rather than files. As a consequence, this new caching system and method provides enhanced performance in an environment of intensive access patterns to shared files.

FIELD OF THE INVENTION

The present invention relates to apparatus and methods for implementinga distributed shared cache memory in a clustered file system,implemented over a cluster of connected computers.

BACKGROUND

Distributed shared memory (DSM) provides an abstraction that allowsusers to view a physically distributed memory of a distributed system asa virtual shared address space. DSM provides a convenience forprogrammers of distributed applications, reducing or eliminating therequirement to be aware of the distributed architecture of the systemand the requirement to use a less intuitive form of communication on adistributed system via message passing. DSM also provides a means todirectly port software written for non-distributed systems to work ondistributed systems.

There are many forms of DSM algorithms and technologies, all of themsharing a fundamental architecture of being composed of distributedagents deployed on a plurality of clustered nodes, maintaining localdata structures and memory segments, and using a communication protocolover a message passing layer to coordinate operations. Message trafficshould be minimized for a given load of work, and of course memorycoherency should be maintained.

File systems improve the efficiency of storage accesses by using cachingmethods to reduce disk accesses. In clustered (a.k.a. shared disk) filesystems, which provide concurrent read and write access from multipleclustered computers to files stored in shared external storage devices,caches are maintained within each computer. In such an architecturecache coherency, namely the integrity of data stored in the distributedcaches, is a major consideration. Generally, all users accessing thefile system should be provided with a consistent and serialized view ofthe files, avoiding corruption of data. Specifically, a read made by auser U1 to block B that follows a write by a user U2 (which may be thesame or another user) to B must return the value written by U2, if noother writes to B were made between the two accesses. In addition,writes to the same block must be sequenced, namely all users view thevalues written to block B in the order that they were applied. Severalapproaches have been suggested for achieving cache coherency. Aprominent and common approach is the write-invalidate method, where awrite operation to a block B invalidates all the copies of that block inother caches.

In existing clustered file systems the resolution for cache coherency isgenerally a file. As long as a file is not modified, the contents of thefile in all caches is consistent. When a user writes to a file, thecontents associated with this file is invalidated in all other caches,in order to ensure a coherent view for other users. If such invalidationdid not occur other users may receive obsolete contents of that file,thus defying cache coherency. When users read from a file, immediatelyafter it was modified, the contents associated with this file in thecache of the user that performed the write operation is typicallywritten to disk, thus maintaining coherency of the data being read.However, as write operations become more frequent, this cache coherencemethod becomes significantly inefficient, as the probability of cachehits is substantially reduced. For high performance distributed systemsthat employ intensive concurrent read/write access patterns to sharedfiles, existing methods for cache coherency within clustered filesystems result in poor performance.

SUMMARY OF THE INVENTION

In accordance with one embodiment of the invention, a method is providedwhich includes:

-   -   providing a clustered file system (CFS) residing on a cluster of        nodes for accessing a shared storage of file system data;    -   providing a local cache memory on each node to reduce file        system access to the shared storage;    -   providing a distributed shared memory (DSM) agent on each node        which DSM agents collectively manage access permissions to the        entire space of file system data as data segments and which        agents utilize the distributed cache memories as a virtual        shared cache.

In one embodiment, the DSM agents determine the latest contents of filesystem data to maintain coherency between the distributed cache memoriesof the CFS. In response to a user request to a local node, useroperations are applied to data segments in the associated local cachememory, including reading requested data segments to the local cachememory and modifying data segments within the local cache memory, inaccordance with permissions granted by the DSM agents. Users performingread only operations are allowed to access the file system dataconcurrently, while the operations of users that require access formodification of a same data segment are serialized.

In one embodiment, each node has a CFS agent for maintaining a local setof data segments in the local cache memory and associated localparameters which include an access permission and ownership by the localDSM agent.

In one embodiment, upon a user's request for allocating a new datasegment, the DSM agents grant an exclusive access permission on theallocated data segment in the shared storage.

In one embodiment, upon a user's request for de-allocating a datasegment, and prior to the de-allocation, the DSM agents grant anexclusive access permission on the de-allocated data segment in theshared storage, and subsequent to de-allocation, the DSM agents releasethe data segment.

In one embodiment, upon a user's request for accessing a data segment,the DSM agents grant the user an access permission on the data segment,and prior to that the DSM agents are informed on the existence of thedata segment contents in the cache memory. Following grant of the accesspermission, the DSM agent instructs the respective local cache memory onhow to obtain the latest contents of the data segment. The DSM agent mayinstruct the respective local cache memory to obtain the latest contentsof the data segment from one of:

-   -   the local cache memory;    -   the remote cache memory via communication of the local DSM agent        with a remote DSM agent;    -   the shared storage.

More Specifically:

-   -   if the DSM agent instructs the local cache memory to obtain the        latest contents of the data segment from the shared storage, the        data segment is read from the shared storage; and    -   if the DSM agent instructs the local cache memory to obtain the        latest contents of the data segment from the local cache memory,        but the data segment is not found present in the local cache        memory, the data segment is read from the shared storage; and    -   if the DSM agent instructs the local cache memory to obtain the        latest contents of the data segment from the local cache memory,        and the data segment is found present in the local cache memory,        the data segment is obtained from the local cache memory; and    -   if the DSM agent provides to the local cache memory the latest        contents of the data segment from the remote cache memory, the        provided data segment is used.

In one embodiment, the DSM agents determine the latest contents of adata segment requested by a user by:

-   -   if ownership of the data segment is with the local agent and        there is no valid access permission on that data segment, then        the data segment should be read from the shared storage;    -   if ownership of the data segment is with the local agent and        there is a valid permission on the data segment (shared or        exclusive), then the data segment contents in the local cache        memory, if it exists, is the latest;    -   if ownership of the data segment is with the remote agent and        the request is for shared permission and the local permission on        the data segment is shared and the data segment exists in the        local cache memory, then the data segment contents in the local        cache memory is the latest; and    -   if ownership of the data segment is with the remote agent and        the previous condition does not apply, then a request message is        sent to the remote DSM agent and the data segment latest        contents is either transported with a response if it is in the        remote cache memory and with a valid permission, otherwise the        data segment latest contents should be read from the shared        storage.

In another embodiment, the DSM agents determine the latest contents of adata segment by:

-   -   upon processing a request from a remote DSM agent for a data        segment, a local DSM agent determines whether the requested data        segment contents exists in local cache memory; and    -   if the requested data segment contents exists in the local cache        and the local DSM agent holds a valid permission on that data        segment, then the local DSM agent obtains it from the local        cache and send it with a response to the remote DSM agent, and        then informs the local cache on completion of usage of the data        segment; and    -   otherwise the local DSM agent does not send that data segment        with the response, signifies the remote cache memory to read        that data segment from the shared storage, and transfers        ownership of that data segment to the remote DSM agent.

In one embodiment, upon transferring ownership of a data segment to aremote DSM agent, and if the requested data segment contents exists inthe local cache memory and it is marked as modified, then the local DSMagent instructs the local cache memory to flush the data segmentcontents to the shared storage, and clears the modification mark of thatdata segment.

In one embodiment, the shared storage includes file system metadata andfile system user data, and the cache memories operate as a virtualshared cache for both the file system metadata and file system userdata.

In one embodiment, the file system metadata is partitioned into regions,which are assigned to each of the agents, such that each region ismodified by a single agent more frequently relative to other agents.

In one embodiment, the CFS has two DSM agents each residing on adifferent one of two nodes.

In other embodiments of the invention, systems and computer programproducts are provided which implement the previously described methodembodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

Several embodiments of the present invention are described hereinafterwith reference to the drawings, in which:

FIG. 1 shows schematically a system for implementing a distributedshared memory in accordance with one embodiment of the invention inwhich DSM Agents A and B reside on different clustered nodes A and B andcommunicate via an unreliable message passing layer;

FIG. 2 is an embodiment of a data structure for DSM table entries;

FIG. 3 is one embodiment of type and data structures for DSM messages;

FIG. 4 is a flow diagram of a procedure for granting shared permissionto a local user, according to one embodiment of the invention;

FIGS. 5A-5B is a flow diagram of a procedure for granting exclusivepermission to a local user, in accordance with one embodiment of theinvention;

FIG. 6 is a flow diagram of a procedure for notification of completionon usage of a local user, in accordance with one embodiment of theinvention;

FIG. 7 is a flow diagram of a procedure for processing a permissionrequest from a remote user, in accordance with one embodiment of theinvention;

FIG. 8 is a schematic illustration of four case scenarios relating to aprotocol for recovering ownership of a data segment among the DSMagents, in accordance with various embodiments of the invention;

FIG. 9 is a flow diagram of a procedure for detecting and resolving a noowner messaging deadlock, according to one embodiment;

FIG. 10 is a flow diagram of a procedure for pruning obsolete messages,according to one embodiment;

FIG. 11 is a flow diagram of a procedure for recovering the latestcontents of a data segment, according to one embodiment;

FIG. 12 is a flow diagram of a procedure for modifying the entry of adata segment after sending a response message, according to oneembodiment;

FIG. 13 shows schematically a system for implementing a distributedshared memory in a clustered file system (CFS) in accordance with oneembodiment of the invention in which CFS agents A and B, each includinga respective DSM agent A and B, reside on different clustered nodes Aand B, and access a common shared storage;

FIG. 14 is a flow diagram of a procedure for allocating a data segment,according to one embodiment of the invention;

FIG. 15 is a flow diagram of a procedure for de-allocating a datasegment, in accordance with one embodiment of the invention;

FIGS. 16A-16B is a flow diagram of a procedure for retrieving a datasegment for usage, in accordance with one embodiment of the invention;

FIG. 17 is a flow diagram of a procedure for releasing usage of aretrieved data segment, in accordance with one embodiment of theinvention; and

FIGS. 18A-18B is a flow diagram of a procedure for determining thelatest contents of the data segment.

DETAILED DESCRIPTION

In various embodiments of the present invention, a clustered file system(CFS) is implemented with a distributed shared memory (DSM). For ease ofunderstanding, various embodiments of a DSM technology will first bedescribed (Section A), followed by various embodiments of a CFStechnology (Section B).

A-1. Distributed Shared Memory (DSM)

Various embodiments of a DSM algorithm and technology will now bedescribed which assume an unreliable underlying message passing layer.Therefore, uncertainty exists regarding whether a message sent hasreached its designation (possibly with delays) or not, and there is nofeedback provided on the fate of each message. It is further assumedthat there is no order on the reception of messages relative to theorder of their generation or sending. Given these assumptions, the DSMalgorithm is able to efficiently maintain memory coherency.

In understanding the described embodiments, the following definitionsmay be useful:

-   -   Computer cluster. A group of connected computers, assumed in        various embodiments to be working together and thus forming in        several respects a single computational unit; such clusters        typically provide improved performance and/or availability.    -   Distributed shared memory. A technology providing an abstraction        that allows users to view a physically distributed memory of a        distributed system as a virtual shared address space.        Abbreviation: DSM.    -   Memory coherency. The integrity of data stored in the        distributed memories comprising a virtual shared memory.        Generally, all users accessing the virtual shared memory,        performing both read and write operations, must be provided with        a consistent and serialized view of the data stored in the        virtual shared memory.    -   User of a distributed shared memory. A procedure that uses DSM,        and is executed by a specific thread of operation within a        computer application.    -   Data segment A memory unit of arbitrary fixed or variable size.        The entire memory space of a DSM is partitioned into data        segments.    -   Permission to access a data segment. A user may obtain        permission to access a specified data segment, atomically with        respect to all other users on all nodes sharing the DSM. The        permission may be shared, namely the data segment may be only        read. This permission can be obtained concurrently by multiple        users with respect to a data segment. Alternatively the        permission may be exclusive, namely the data segment may be also        modified. This permission is mutual exclusive with all other        users with respect to a data segment. A valid permission is        either a shared or an exclusive permission.    -   Mutual exclusion. Conditions according to which users are either        permitted to access data segments or alternatively blocked, due        to access permissions concurrently held by other users.        Specifically, a request for shared access permission on a data        segment must block as long as there is a user holding an active        exclusive access permission on that data segment, or there is a        pending user waiting for exclusive access permission on that        data segment (under certain conditions). A request for exclusive        access permission on a data segment must block as long as there        is another user with an active permission on that data segment.    -   Upgrade of permission. An operation of switching from no        permission to shared or exclusive permission on a data segment,        or switching from shared permission to exclusive permission on a        data segment.    -   Ownership of a data segment Each data segment is owned at any        given time by no more than one of the DSM agents. The identity        of the owner of each data segment (i.e. local or remote) is        recorded by each agent in the data segment's entry. Ownership of        a data segment may be transferred to another node, as a result        of processing user requests. The owner of a data segment        serializes processing of requests issued in parallel for that        data segment, and has complete knowledge on the whereabouts of        the latest contents of that data segment. When a user requires        an upgrade of permission on a specific data segment, a request        must be issued to the owner of that data segment if the owner is        remote.    -   Message passing. A form of communication, commonly used in        distributed and clustered computing, based on sending of        messages to recipients.    -   Messaging session. A communication between the DSM agents, with        regard to a data segment, comprising a request message from        agent A to agent B and a subsequent response message from agent        B to agent A. A messaging session is terminated upon reception        of a response from the other agent or when the operation within        which the request was sent times out. A single messaging session        is allowed per data segment at a time.

A-2. DSM Agents, Table Entries, Data Fields, and Permissions

In accordance with one embodiment, the DSM technology (FIG. 1) consistsof two agents 10 (DSM Agent A) and 12 (DSM Agent B), each residing on adifferent one of the clustered nodes A and B (6, 8 respectively), eachnode having a set of local applications (users) 1 to N (7, 9respectively), and each agent using a local set of memory data segments14, 16 and an associated table of entries 15, 17, wherein each datasegment is associated with an entry. The DSM agents A and B each haveprocedures 2, 4 for handling their respective local requests 7, 9, i.e.,issued by local users (applications) 1 through N, and procedures 3, 5for handling remote requests (from the other agent) via an unreliablemessage passing layer 1 [Therese: My understanding is that the messagepassing layer is unreliable but the proposed protocol is reliable].

The entire memory space of the DSM is partitioned into data segments ofarbitrary fixed or variable sizes. A user may obtain permission toaccess a specified data segment, atomically with respect to all otherusers on all nodes sharing the DSM. The permission may be shared, namelythe data segment may be only read. This permission can be obtainedconcurrently by multiple users with regard to a data segment.Alternatively the permission may be exclusive, namely the data segmentmay be also modified. This permission is mutual exclusive with all otherusers with regard to a data segment. A valid permission means eithershared or exclusive permission. The latest permission for each datasegment is recorded by each agent 10, 12 within its respective table ofentries 15, 17. Permissions are modified only due to user requests.

Each data segment has an owner, which is set to be one of the two DSMagents 10, 12. The owner's identify for each data segment (i.e. local orremote) is recorded by each agent in the data segment's entry (in tables15, 17). When a user requires an upgrade of permission on a specificdata segment, a request must be issued to the owner of that data segmentif the owner is remote. The owner of a data segment serializesprocessing of requests issued in parallel for that data segment, and hascomplete knowledge on the whereabouts of the latest contents of thatdata segment. Ownership of a data segment may be exchanged between theagents, triggered by processing of user requests, in the followingcases: a) when a user is given exclusive permission on a data segment,the agent of its node is set to be the owner of that data segment; b)when a user is given shared permission on a data segment and the remoteowner does not have any permission on that data segment, the agent ofthe node of the requesting user is set to be the owner of that datasegment.

To facilitate the DSM algorithm, each DSM agent maintains a local tableof entries. An example of a data structure 25 for the DSM table ofentries is illustrated in FIG. 2. Each entry is associated with a datasegment, and consists of the following data fields:

-   -   Owner—indicates whether the current owner of the data segment is        local or remote;    -   Permission—indicates the local permission on the data segment        (may be none, shared or exclusive);    -   Copies—set to true if the local agent is the owner of the data        segment and the remote agent has a copy of the data segment,        otherwise set to false;    -   Usage—indicates the number of users currently using the data        segment on the local node. This counter is incremented when a        user receives a permission on the data segment, and decremented        when a user having a valid permission notifies on termination of        usage.    -   Pending Exclusives—indicates the number of pending exclusive        requests on the data segment on the local node. This counter is        desirable in order to avoid starvation of users requesting        exclusive permission, in a case where there is an endless stream        of sequential users requesting shared permission. When a user        requesting an exclusive permission has to block due to mutual        exclusion, this counter is incremented thus informing other        users on this pending request, and decrements this counter after        clearing mutual exclusion. Users requesting shared permission        block in certain conditions if this counter is non-zero.

Additional fields, described herewith, are used to facilitate detectionand resolving of messaging deadlock situations, and to recover thelatest contents of data segments, as elaborated in the next sections:

-   -   Message Out—indicates the type of request message concerning the        data segment that was sent to the remote agent and not responded        yet. If there is no ongoing messaging session, this field is set        to a null value.    -   Message Id Local, Message Id Remote—indicate the latest ids of        messages, concerning the data segment, generated by the local        agent and received from the remote agent correspondingly.    -   Data Segment Version—indicates the version number of the data        segment contents stored at the local agent.    -   No Owner Deadlock Resolving Indication—used to prevent redundant        deadlock resolving threads for a data segment which is in a        state of no owner.

To facilitate efficient scalability in terms of the number of datasegments managed by the DSM agents, the table of entries should becompact, meaning that the values of each field are encoded so that eachfield is allocated with a minimal number of bits.

Each entry is also augmented with four synchronization mechanisms. Onemechanism facilitates mutual exclusion for accessing the entry's fields.The other three mechanisms enable synchronized blocking and awakeningfor users that identify mutual exclusion conditions that necessitatetheir blocking; more specifically, one is for users seeking sharedpermission, a second is for users seeking exclusive permission, and athird is for users that identify an ongoing messaging session.

When a user requires a permission, which entails upgrading the currentpermission held by its local agent on the requested data segment(upgrading means switching from no permission to shared or exclusivepermission on a data segment, or switching from shared permission toexclusive permission on a data segment), a message may be sent to theremote agent to coordinate processing of the request. There are fourtypes of messages between DSM agents:

-   -   Permission request: Sent from a non-owner agent to the agent        holding ownership of a data segment, in order to upgrade        permission on that data segment.    -   Permission response: Sent from an agent holding ownership of a        data segment to the remote agent, granting to the remote agent        the requested permission.    -   Invalidation request: Sent from an agent holding ownership of a        data segment to the remote agent, in a case where the owning        agent requires to upgrade its permission from shared to        exclusive, and the remote agent may hold valid copies of that        data segment.    -   Invalidation response: Sent from a non-owner agent to the agent        holding ownership of a data segment, acknowledging invalidation        of the requested data segment.        FIG. 3 illustrates one embodiment of data structures 26 for each        of these requests and associated responses for DSM messaging.

When processing a request for permission from a local or remote user(via a message), the handling procedure must first check for anyconditions that entail it to block, and it may not proceed until theblocking conditions are cleared. One condition for blocking is mutualexclusion. Namely, a request for shared access permission on a datasegment must block as long as there is a user holding active exclusiveaccess permission on that data segment, or there is a pending userwaiting for exclusive access permission on that data segment (thisapplies under certain conditions). A request for exclusive accesspermission on a data segment must block as long as there is another userwith an active permission on that data segment. In addition to mutualexclusion conditions, a handling procedure must block as long as thereis an ongoing messaging session (indicated by the Message Out field). Amessaging session is terminated upon reception of a response from theremote agent or when the operation within which the request was senttimes out. This enables to maintain a single messaging session per datasegment at a time.

Further details of the DSM handling procedures are explained below.

A-3. DSM Handling Procedures

Several handling procedures are defined within the DSM algorithm. Theseprocedures are described below with reference to FIGS. 4-7.

A procedure 40 for handling a request of a local user for sharedpermission (FIG. 4) checks 42 first the blocking conditions, asspecified earlier, and blocks 44 until these conditions are cleared. Ifownership is determined 46 to be local, a shared permission is grantedby the local agent and the usage count is incremented by one 48 and theprocedure terminates 50. If ownership is determined 46 to be remote andthe local agent is determined 52 to hold shared permission on the datasegment, the usage count is incremented by one 48 and the procedureterminates 50. If ownership is determined 52 to be remote and the localagent does not hold a valid permission, a message is sent 54 to theremote agent requesting shared permission on that data segment. When aresponse is received, with the latest data segment contents, sharedpermission is granted and the usage count is incremented by one 56.According to the response, ownership of the data segment may be alsotransferred 58. In this case the local agent records its ownership andthe copies indication is set 60 to true if the remote agent keeps sharedpermission or false otherwise, and the procedure terminates 50.

A procedure 70 for handling a request of a local user for exclusivepermission (FIGS. 5A-5B) checks 74 first the blocking conditions, asspecified earlier, blocking 76 until these conditions are cleared. Thepending exclusive counter is incremented 72 before checking theseconditions and decremented 78 after clearing them. If ownership isdetermined 80 to be local and it is determined that 82 the local agenthas an exclusive or no permission or shared permission without copies ofthe data segment, then an exclusive permission is granted 84 by thelocal agent and the usage count is incremented by one 84, and theprocedure terminates 86. If ownership is determined 80 to be local andthe local agent has a shared permission with copies, then a message issent 88 to the remote agent requesting to invalidate its copies. Uponreception of a response 88 the copies indication is set 91 to false, anexclusive permission is granted by the local agent and the usage countis incremented by one 84 and the procedure terminates 86. If ownershipis determined 80 to be remote, a message is sent 90 to the remote agentrequesting an exclusive permission on the data segment. Upon receptionof a response 90, with the latest data segment contents, an exclusivepermission is granted (resetting the copies field), ownership is set tothe local agent and the usage count is incremented by one 92, and theprocedure terminates 86.

A procedure 100 for handling a local user notification of termination ofusage of a data segment (FIG. 6) decreases by one the usage count ofthat data segment 102. If the permission on that data segment isdetermined 104 to be shared and it is determined 106 that the new valueof the usage count is zero and there is a non-zero number of pendingexclusive requests, then a single blocked user that issued an exclusiverequest on that data segment is awakened 108, and the procedureterminates 112. If the permission on that data segment is determined 104to be exclusive then all blocked users that issued a shared request anda single blocked user that issued an exclusive request (if it exists) onthat data segment are awakened 110, and the procedure terminates 112.

A procedure 120 for handling a message sent by a remote user requestingpermission on a data segment (FIG. 7) checks 124 first the blockingconditions, as specified earlier, blocking 125 until these conditionsare cleared. If the request is for exclusive permission, the pendingexclusive counter is incremented 122 before checking these conditionsand decremented 126 after clearing them. A response is then sent 130 tothe requesting agent and the data segment's entry is updated 132, basedon the following calculations 128. Ownership is transferred if therequest is for exclusive permission, or the request is for sharedpermission and the local agent does not have a valid permission on thedata segment. The copies field is reset if the ownership is transferred.The local permission is invalidated if the request is for exclusivepermission or there is no current valid permission. Otherwise the localpermission is set to shared. The data segment contents is sent if thereis current valid permission on that data segment. In addition, in casethe request is for exclusive permission blocked users are awakened 134,and the procedure terminates 136, so that one of the unblocked usersshall send a request to the remote owner.

The procedure for handling a message sent by a remote user requestinginvalidation of a shared permission on a data segment checks first theblocking conditions 124, as specified earlier, blocking 125 until theseconditions are cleared. The pending exclusive counter is incremented 122before checking these conditions and decremented 126 after clearingthem. However, since there may be a deadlock between an invalidaterequest (from owning agent to non-owning agent) and a permission request(from non-owning agent to owning agent), the procedure handling theinvalidation request is defined to resolve such a deadlock, by avoidingblocking due to an ongoing messaging session in case such a deadlock isidentified (the method for identification is specified in the followingsections). After clearing the blocking conditions the local permissionis invalidated, blocked users are awakened, so that one of them shallsent a request to the remote owner, and a response acknowledging theinvalidation is the sent to the requesting agent.

A-4. Support of Unreliable Message Passing

Because real-life message passing technologies are unreliable, assumingfull reliability of an underlying message passing technology wouldexpose a DSM technology to a non-zero probability of data corruption.The DSM algorithm and technology of the present embodiment supportsunreliable message passing technologies. It assumes complete uncertaintyon whether a message that is sent reaches its destination (possibly withdelays) or not, and assumes there is no feedback on the fate of eachmessage. It further assumes no ordering on the reception of messagesrelative to the order of their generation or sending. Given theseassumptions, the present DSM algorithm efficiently maintains consistencyboth of user and internal data, and does not require additional messagesnor run-time for this support.

Given an underlying unreliable message passing technology, the followingproblems arise and should be resolved:

-   a) Ownership of a data segment may be lost when a message, sent in    response to a permission request, carries a transfer of ownership    and the message is lost or delayed. Note that the agent sending such    a response waives its ownership regardless of the fate of the    response. Since most operations require a valid owner for a data    segment, the owner should be recovered;-   b) It must be ensured that a data segment never has two owners,    since such a situation may cause data corruption; and-   c) Since the owner of a data segment has complete knowledge of the    whereabouts of the latest contents of the data segment, if ownership    is lost this knowledge is also lost, and should be recovered.

A-5. Recovering Ownership of a Data Segment

Consider the first and second problems. When ownership of a data segmentis lost, the present DSM algorithm employs the following protocol forrecovering the ownership, ensuring that there are no two owners of adata segment. In the initial state both agents are not owners of theconsidered data segment, and thus assume that the other agent is theowner. The basic idea is that ownership can not be taken by an agent; itcan only be given by the other agent. When an agent receives a requestaddressed to the owner of a data segment (i.e. a permission request),and that agent is not recorded as the owner in its local entry of thedata segment, it deterministically concludes that there is currently noowner of that data segment cluster-wide, and it gives ownership of thatdata segment to the other agent within the response it sends. If thisresponse reaches the other agent, in a time frame by which the user thattriggered sending the request is still waiting for the response, theagent that receives the response becomes the new owner of the datasegment. In case a response is received when the user that triggeredsending the request is no longer waiting for the response (i.e. the usertimed out), this response is discarded, regardless of its contents.

This protocol ensures that a data segment never has two owners, since itis impossible that the two agents receive ownership of a data segmentfrom each other at the same time, as further elaborated. Recall that anagent may send only one request per data segment at a time. Consider thefollowing four (4) cases illustrated in FIG. 8:

Case 1 (140): Agent A 142 sends a request 144 that reaches agent B 146before B sends any request on that data segment. In this case agent Bsends a response 148 (giving ownership to agent A), that reaches agent Awhile the relevant user is still waiting 150 for the response (arequesting local user of A has not timed out). Agent A becomes the newowner 152, and agent B remains not an owner 154.

Case 2 (160): This case is similar to case 1, except that the response168 sent by agent B 166 reaches agent A 162 after the wait period 170 ofthe relevant user has timed out, thus the response 168 is discarded 169.Therefore, both agents are not the owners 172,174 of the data segment.

Case 3 (180): Agent A 182 sends a request 184 that reaches agent B 186after B sends a request 196 on the same data segment. Both requests 184,196 become blocked on the remote side as their handling proceduresidentify an ongoing messaging session. One of the two users thattriggered sending the requests times out and the agent of the timed outuser eventually processes the request of its counterpart agent and sendsa response. Assume without loss of generality that the user timing out190 is affiliated with agent A, the response 198 reaches the useraffiliated with agent B before timing out 199, in which case only agentB becomes the owner 194, since agent A shall discard 197 the response188 to the original request 184 of agent A.

Case 4 (200): This case is similar to case 3, except that the response218 from agent A 202 reaches the user affiliated with agent B 206 aftertiming out 219, in which case both responses 218, 208 sent by bothagents are discarded 215, 217 by their remote agents. Therefore bothagents are not the owners 212, 214 of the data segment.

A-6. Resolving a No Owner Messaging Deadlock

In the scenario of case 4, both agents 202, 206 send concurrentpermission requests 204, 216 on a same data segment not owned by both,and both responses 208, 218 are discarded 217, 215, thus failing bothrequests and failing to recover ownership of that data segment 212, 214.This scenario is referred to as a no owner messaging deadlock. Datasegments that are accessed with high contention from both agents, forwhich ownership is lost, may exhibit sequentially repeating occurrencesof this scenario, thus detrimentally affecting performance. To improveperformance the DSM algorithm of the present embodiment employs aprocedure 220 illustrated in FIG. 9 which deterministically detectswhether such a deadlock occurs, and upon detection one agent resolvesthe deadlock. Noting that detection of such a deadlock must bedeterministic; otherwise both nodes may receive ownership of a datasegment, causing data corruption.

As shown in FIG. 9, such a deadlock is detected by an agent A when, uponreceiving 222 and processing 224-236 a message of agent B requestingpermission on a data segment P, the following conditions are determinedto be true:

-   a) Agent A is not the owner of data segment P (determining step 226    based on the entry's ownerfield);-   b) There is currently an ongoing messaging session requesting    permission on data segment P (determining step 224 based on the    entry's message out field);-   c) Agent B did not see agent A's permission request message before    sending its permission request message (determining step 228 based    on the entry's message Id field);

While the calculations of conditions a and b are more straightforward,the calculation and associated logic required for condition c requiressome elaboration, which is given in the next section.

Upon detection of such a deadlock, only one predetermined agent(determining step 230), and only a single user operating via the onepredetermined agent on data segment P (determining step 232 based on theentry's no owner deadlock resolving indication field) may enter thedeadlock resolving protocol. The handling procedure of this single userwithin the predetermined agent avoids waiting for completion of themessaging session, and sends 234 a response, thus resolving thedeadlock, and the procedure thereafter terminates 236. Meanwhile, theother users operating via both agents have waited 238 for completion ofthe messaging session.

A-7. Detection and Resolving of Messaging Deadlocks

Messages arrive at their destination with an arbitrary order relative tothe order in which they were generated or sent. A messaging deadlocksituation occurs when both agents concurrently send a request message onthe same data segment before seeing the requests of their counterparts.Since processing of all local and remote requests on that data segmentis blocked until the messaging sessions complete, such a sequencecreates a messaging deadlock.

There are two types of messaging deadlocks in the context of the presentDSM algorithm. One type is the no owner messaging deadlock described inthe previous section. Another type is a deadlock termedpermission/invalidation messaging deadlock, where the agent set as theowner of a data segment requires to upgrade the data segment'spermission from shared to exclusive, and the non-owning agent alsorequires to upgrade the data segment's permission. Thus, the owningagent sends an invalidation request, and the non-owning agent sends apermission request. If both requests are sent before receiving andseeing the remote agents' requests, a deadlock is formed.

To identify messaging deadlocks, the present DSM algorithm employs amessage id mechanism described herewith. Note that identification of thedeadlock must be deterministic, otherwise data corruption may occur.Each agent maintains two message ids for each data segment - one id forthe local agent and the second id for the remote agent. When an agentgenerates a message, an associated locally unique message id isgenerated and recorded in the message id local field of the datasegment's entry. Messages are augmented with the values of the messageids (local and remote) stored in the relevant data segment's entry. Whena message from the remote agent is handled by the local agent, themessage id remote field of the data segment's entry is set by the localagent to equal the id of that message, thus signifying the latestmessage of the remote agent that was seen by the local agent.

Detection of messaging deadlocks is done within the procedures thatprocess messages from the remote agent (see FIG. 9). The agents use themessage ids stored in the data segment's entry (see FIG. 2) and receivedwith the message to determine whether or not the remote agent saw thelatest message sent by the local agent before sending its message.Specifically if the local message id is different than the local messageid sent with the message from the remote agent, meaning that the remoteagent did not see the message sent by the local agent before sending itsmessage, then a deadlock is identified.

When a deadlock is identified, one of the agents, determined dynamicallyor statically (depending on the type of deadlock as described next),avoids waiting for the remote agent's response, thus resolving thedeadlock. In a no owner messaging deadlock the resolving agent ispredefined statically. In a permission/invalidation messaging deadlockthe resolving agent is the one processing the invalidation requestmessage (namely, the agent that sent the permission request message, andis the non-owning agent).

An additional use of the message id mechanism is for pruning obsoletemessages (illustrated by the procedure 240 shown in FIG. 10). Sincemessages arrive and are transferred for processing in an arbitrary orderrelative to their generation and sending, an agent may receive obsoletemessages which should not be processed. If such a message is processedownership may be lost, if the remote user that generated this messagehas already timed out. Therefore, upon reception of a message (step242), and after waiting to clear any blocking conditions of an ongoingmessaging session or mutual exclusion (step 244), the receiving agentdetermines (step 246) that the message is obsolete if the remote messageid conveyed with the message is of a smaller order than the remotemessage id stored in the data segment's entry. If the message isdetermined to be obsolete, it is discarded and processing completes(step 250). Otherwise, the receiving agent processes the remote agent'srequest and sends (step 248) a response, which completes the process(step 250).

Message ids should be locally unique in order to support the no ownermessaging deadlock, and should further enable ordering of the messagesrelative to their order of generation in order to support pruning ofobsolete messages. These message ids should be allocated with sufficientsize, so that a complete cycle of these ids including wrap-around ispractically impossible with regard to the frequency of messagingsessions. Avoiding wrap-around should also be considered whencalculating the difference between the values of message ids.

A-8. Recovering the Latest Data Segment Contents

When the ownership of a data segment is lost, the knowledge on thewhereabouts of the latest contents of the data segment, normally storedwith the owner, is also lost. Therefore, as part of the ownershiprecovery algorithm, specified in the previous sections, the latestcontents of the data segment should be also identified and restored. Aprocedure for this purpose is illustrated in FIG. 11.

The computation for determining the location of the latest contents of adata segment with no owner is done within the procedure that processes apermission request message from the remote agent (e.g., the steps 262and 264 of receiving a permission request from a remote agent andwaiting to clear any blocking conditions of an ongoing messaging sessionor mutual exclusion). As further illustrated in FIG. 11, if the localagent determines (step 266) that it has a valid permission on the datasegment, then the data segment's contents available to the local agentis latest, thus deterministically identified, and this contents can besent (step 271) to the remote agent with the response (step 272) givingownership, thus restoring the latest data segment's contents, andcompleting the process (step 274). Otherwise, step 266 determines thereis no valid permission locally, and the latest contents of the datasegment may be at either side. In this case data segment versionnumbers, maintained by each agent for each data segment, and conveyedwith messages, are compared (step 268). The responding agent comparesthe data segment version number conveyed with the message to its owndata segment version number, and determines that the data segmentcontents available locally is latest if the local version number is morerecent than the version number sent by the remote agent. Only in thiscase the responding agent sends (step 271) its data segment contents tothe remote agent; otherwise the responding agent does not send (step270) its data segment contents.

Preferably, so that a data segment entry is highly compact, the datasegment version number field is allocated with a minimal number of bits.Small version number fields (e.g. 2 bits) with fast wrap-around requirea special method for maintaining them, specified herewith. Data segmentversion numbers are maintained so that when both agents have the samedata segment contents their associated version numbers shall beidentical; and when an agent updates a data segment, its version numbershall be different (e.g. larger by one) than the version number storedby the remote agent. One embodiment of a method for setting the valuesof a data segment version number is described as follows.

When an agent upgrades its permission on a data segment from shared toexclusive, the data segment version number stored with that agent is setto equal a value larger by one relative to the version number storedwith the remote agent. When an agent upgrades its permission on a datasegment to shared permission, the data segment version number storedwith that agent is set to equal the version number sent by the remoteagent. The specifics of this method are further elaborated below.

In the case where the ownership is local and there is no permission onthe data segment, regardless of the requested permission, the datasegment version number is incremented by one relative to the storedversion number.

In the case where the request is for shared permission: If ownership isremote and the data segment contents has been conveyed with the responsemessage (meaning that the remote agent's contents is latest) and theremote agent keeps its shared permission, then the data segment versionnumber is set to the remote agent's data segment version number conveyedwithin the message. Otherwise, if the remote agent does not keep a validpermission, then the data segment version number is incremented by onecompared to the remote agent's version number.

In the case where the request is for exclusive permission: If theownership is local and the current permission is shared and the remoteagent has a copy of the data segment, then an invalidation request issent to the remote agent and responded, to subsequently setting the datasegment version number to a value larger by one than the version numberconveyed with the remote agent's response. If the remote agent does nothave copies (i.e. no invalidation request is sent), then the datasegment version number is not modified, since there is already adifference of one between the local and the remote version numbers.Further elaborating, there are no copies due to either a previousexclusive permission request or invalidation request sent from theremote agent, or a previous shared permission request of a local userupgrading from no permission (where ownership is local)—in all cases theversion number was already incremented. If ownership is remote and apermission request message is sent to the remote agent, then regardlessif the data segment contents is sent with the response from the remoteagent, the data segment version number is set to a value larger by onethan the version number conveyed with the remote agent's message (thuscreating a difference of one), since an exclusive permission is granted.

A-9. Modifying the Data Segment Entry after Sending a Response Message

Consider a procedure (e.g. FIG. 7) that processes a permission requestmessage sent from the remote agent. After this procedure sends aresponse message to the remote agent, it must modify the data segment'sentry to its new state, regardless of the unknown fate of the message.However, since this procedure features the method for resolving the noowner messaging deadlock (FIG. 9), operating concurrently with otheroperations, caution is exercised with regard to updating the datasegment's entry, and it is modified in the following two cases.

As illustrated in FIG. 12, in a procedure for handling a permissionrequest from a remote agent (steps 282-286), if it is determined (step288) that this procedure does not activate the deadlock resolvingmethod, then the entry is updated (step 291) and the process terminates(step 294). If it is determined (step 288) that this procedure activatesthe deadlock resolving method and it is determined (step 290) that aconcurrent procedure operating on the same data segment has not yetreached the point of updating the data segment's entry, then the entryis updated (step 291), otherwise the deadlock resolving procedure doesnot update (step 292) the data segment's entry. This way, a deadlockresolving procedure does not override modifications made by a procedurethat does not activate this method. This avoidance is required, sinceeither the deadlock was indeed resolved by the deadlock resolvingprocedure, or the response it sent was no longer awaited for—in bothcases its subsequent update of the data segment's entry is no longerrequired.

A-10. Summary

There has been described one embodiment of a DSM algorithm andtechnology in a two (2) node cluster that uniquely supports unreliableunderlying message passing technologies. The DSM algorithm assumescomplete uncertainty on whether a message that is sent reaches itsdestination (possibly with delays) or not, and assumes there is nofeedback on the fate of each message. It further assumes no ordering onthe reception of messages relative to their order of generation andsending. Given these assumptions, the present DSM algorithm efficientlymaintains full consistency of both user and internal data.

B-1. Introduction to Distributed Shared Caching for Clustered FileSystems (CFS)

In accordance with various embodiments of the present invention, amethod is provided for efficient caching, guaranteeing cache coherency,for clustered file systems. In contrast to existing methods, the presentcaching method provides good performance in an environment of intensiveaccess patterns to shared files. In the present method, cache coherencyis achieved based on a resolution of fixed or variable sized andrelatively small (e.g. a few kilo bytes) data segments, rather thanfiles. In this way cache coherency is disassociated from the concepts offiles. Coordination between the distributed caches (includinginvalidation of segments), their coherency and concurrency management,are all done based on the granularity of data segments rather thanfiles. The present method utilizes the distributed shared memory (DSM)technology previously described, for cache management. DSM provides anabstraction that allows users to view a physically distributed memory ofa distributed system as a virtual shared address space. Thus, with thepresent method, when a user writes to a file, only the affected datasegments are invalidated in the other caches, thus tightly bounding themodified regions of data. Consequently, the proposed solution increasesthe probability of cache hits, and maintains high efficiency insituations of intensive access patterns to shared files.

B-2. Architecture of the CFS Caching Method

In the disclosed embodiment, the new method is embedded within a twonode 306, 308 clustered file system 300. FIG. 13 depicts the CFSarchitecture, wherein components corresponding to those in FIG. 1 (theDSM architecture) have been given similar reference numbers (in the 300range). The DSM agents 310, 312 manage access permissions to the entirespace of file system data in a shared storage 320, (e.g., shared diskstorage) including file system metadata 321 and file system user data322, via input/output requests 323. Each of nodes 306, 308 has anassociated set of local users 307, 309, respectively.

The file system logic components 330, 332 (CFS Agents A and B on nodes Aand B respectively) are partitioned into two high level components. Thefirst component 331, 333 manages the storage and the association ofstorage segments to data segments and/or files. It uses file systemmetadata on the shared storage 320 to facilitate its operations, andallocates storage for user data as required. Distinctive from existingclustered file systems, where this component provides users only withthe abstraction of files, in the present architecture this componentprovides also the abstraction of data segments, in addition to theabstraction of files. Such data segments may be provided either groupedby or independent of files. In the former case, files are regarded assets of data segments. The second component 334, 335 manages access toshared storage 320, relying also on the storage management (first)component 331, 333. A main functionality of this second component iscaching to reduce disk accesses. Caching may be applied to both filesystem metadata and user data. In this architecture, efficient andcoherent caching is implemented via an integration of a cache component337, 339 with a DSM component 310, 312 (respectively for each of nodes306 and 308).

The CFS agents 330, 332 each manage a set of data segments in theirlocal cache 337, 339 whose total size is typically significantly smallerthan the capacity of available storage. A data segment in the cache maybe associated with a data segment in the shared storage, or may bedisassociated from any data segment (i.e. available). Data segments inuse are locked in the cache, in the sense that these data segmentscannot be disassociated from their disk data segments. When such datasegments are not used any more, and other disk data segments arerequired for access, they can be disassociated from their disk datasegments, using for example a Least Recently Used mechanism, foreviction from the cache.

The DSM components 310, 312 provide an abstraction that allows thephysically distributed caches 337, 339 within the distributed CFS agents330, 332 of the clustered file system to behave as a shared virtuallyglobal cache. The DSM components manage access permissions to the entirespace of file system data in shared storage 320, while, in contrast totraditional DSM technologies, the DSM agents here do not have aninternal set of memory data segments, rather they are integrated withtheir local cache components 337, 339 that enable to load only a smallrelevant subset of the file system data into cache. The DSM components337, 339 also provide instructions to their associated storage accesscomponents 334, 335 on the required method for obtaining the latestcontents of a data segment specified for retrieval, optionallyretrieving the latest contents via messaging 301 with the remote DSMagent.

Elaboration on the basic operation of the DSM components has beenpresented in the prior sections of this application. Elaboration on theintegrated operation of the DSM component and the cache component withinthe storage access component, is presented in the following section.

B-3. Using DSM for Caching within a Clustered File System

In the context of understanding the following detailed embodiment, thefollowing definitions may be useful (in addition to the definitionspreviously provided in a discussion of the DSM):

-   Shared storage. Storage devices that are accessible by multiple    computers.-   Clustered file system. A file system that provides concurrent read    and write access from multiple clustered computers to files stored    in shared external storage devices.-   Cache coherency. The integrity of data stored in the distributed    cache memories comprising a virtual shared cache. Generally, all    users accessing the virtual shared cache, performing both read and    write operations, must be provided with a coherent and serialized    view of the data stored in the virtual shared cache.-   User of a clustered file system. A procedure that uses CFS, and is    executed by a specific thread of operation within a computer    application.

The clustered file system provides a data segment based interface foraccessing files and/or storage. A user may open and close files tonotify on beginning and completion of access to specific files. A usermay perform the following operations in accordance with one embodimentof the invention:

-   Allocate a data segment: The user is provided with the address of    the newly allocated disk data segment, and a pointer to a cache data    segment associated with this disk data segment. The permission on    the allocated data segment is set to exclusive.-   De-allocate a data segment: The user provides the address of a disk    data segment for de-allocation, and the file system de-allocates    that data segment.-   Retrieve an already allocated data segment with a shared or    exclusive permission: The user provides an address of an already    allocated disk data segment; and the file system grants the required    permission on that data segment, retrieves its latest contents,    loads it into a cache data segment, and returns a pointer to this    cache data segment.-   Mark a retrieved data segment as modified: The user provides an    address of a retrieved disk data segment, signifying that the    contents of this data segment has been modified and should be    written to disk. The data segment must have been retrieved with an    exclusive permission.-   Signify on completion of usage of a retrieved data segment: The user    provides an address of a retrieved disk data segment, signifying on    completion of its usage.-   Write cache data segments that are marked as modified to the shared    storage.

In the remainder of this section, methods of using the DSM and cachecomponents within the procedures that implement the aforementionedfunctionalities are specified.

A procedure 340 for allocating a data segment (FIG. 14) begins byallocating 342 a disk data segment via the storage management component.Then a cache data segment is associated with the newly allocated diskdata segment and locked in cache memory (by incrementing its usagecount) 350. Associating a cache data segment is done in the followingway: If it is determined that 344 there are unassociated cache datasegments, one of them is associated 350 with the new disk data segment.If there are no unassociated cache data segments, and it is determined346 there is an unlocked data segment, then one of the associated andunlocked data segments is used. If such an associated and unlocked datasegments is determined 347 to be marked as modified, then it is written349 to the shared storage before usage. If not, the data segment'scurrent contents is discarded 351. If all cache data segments areassociated and locked, then the cache may be dynamically extended 348.Upon association, the associated cache data segment is cleared 350, andmarked as modified. Following the allocation of a cache data segment, anexclusive permission is acquired 352 on that disk data segment using theDSM component, and the procedure ends 354. There will not be anycontention on the data segment, and the data segment's contents will notbe overwritten by the DSM component, since the data segment in theremote agent's cache is not valid.

A procedure 360 for de-allocating a data segment (FIG. 15) begins byensuring 362 that the disk data segment must not be in shared permissionand in use. The disk data segment must be in an active exclusivepermission before de-allocation. If this is not the case, an exclusivepermission is acquired 363 by the procedure on the disk data segment.This invalidates a corresponding cache data segment in the remoteagent's storage access component, so if the remote agent allocates thisdata segment, its contents in the local cache of that agent will not beconsidered as valid. There must not be any contention on the datasegment. Then, if it is determined that 364 there is a cache datasegment associated with that disk data segment, it is disassociated 365.This is followed by de-allocation 366 of the disk data segment via thestorage management component. Finally, the disk data segment is released367 also via the DSM component, and the process ends 368.

A procedure 370 for retrieving a disk data segment for usage (FIGS.16A-16B) begins by examining 372 the cache for the presence of that datasegment. If it is determined that 374 this data segment is notassociated with any cache data segment, a cache data segment isassociated 376 using the method described within the data segmentallocation procedure 371, 378-379. Then permission is acquired on thedisk data segment via DSM according to the user's request 380—shared 381or exclusive 382. In this context, there is a special case, where a newcache data segment was allocated, and the request is for sharedpermission, and there is a valid shared permission on that data segment,and ownership of that data segment is remote, although normally nomessage should be sent to the remote agent to acquire permission, inthis case a message is sent to the remote agent to retrieve the latestdata segment contents. Upon acquiring permission, an instruction 383 isgiven by the DSM component on how to obtain the latest contents of thatdata segment. There are three possibilities in this context. The firstis that the contents of that data segment in the local cache, if itexists, is latest. The second is that the latest contents of that datasegment is provided by the DSM component via communication with theremote DSM agent. The third is that the latest data segment contentsshould be read from disk. Therefore, the data segment contents should beread from disk 385, in the context of the current procedure, in thefollowing cases: The DSM component instructs to read the latest datasegment contents from disk; or the DSM component instructs that the datasegment contents in the local cache (if it exists) is latest but a newcache data segment was associated with the disk data segment within thisprocedure 384. In any other case, the disk data segment is not read fromdisk, and the process ends 386.

A procedure for marking a retrieved data segment as modified begins byensuring that there is an active exclusive permission on that datasegment and that there is a cache data segment associated with that diskdata segment. If so, this cache data segment is marked as modified, soit can be flushed to disk within the next flush operation.

Flushing modified data segments to disk may be done by periodic flushoperations, triggered by the user or the file system. The file systemmay decide to flush a set of data segments, when some conditions apply,for example, when the number of cache data segments marked as modifiedexceeds some threshold, or when the number of unassociated data segmentsin the cache is not sufficient. The flushing mechanism may be augmentedwith transactional or journaling support, entailing first flushing themodified cache data segments or a respective representation of theirmodifications to a log or a journal and then flushing these datasegments to their final location in the shared storage. This enablesimproving robustness to failures by preventing data consistencyproblems. The cost entailed is additional write operations involved inflush operations. In addition, upon eviction of modified and unlockeddata segments from cache, such data segments are flushed to the sharedstorage.

A procedure 390 for releasing usage of a retrieved data segment (FIG.17) begins with decrementing 391 the usage counter of the associatedcache data segment. If it is determined 392 that the new usage value iszero, then the cache data segment is unlocked 393 (i.e. it may beevacuated from the cache). Then the disk data segment is released 394via the DSM component, and the process ends 395.

When a DSM agent processes a request from the remote DSM agent, it maybe required to convey the latest contents of a data segment, if presentin the local cache, to the remote agent. To facilitate this the DSMprocedure that processes request messages from the remote agent uses aninterface provided by the local cache component. Such a DSM proceduredetermines with the local cache whether the requested disk data segmentis associated with a cache data segment or not. If the data segment isassociated with a cache data segment and the DSM agent has a validpermission on that data segment, then the DSM agent retrieves it fromthe cache (also locking it in the cache), sends it with the response,and then signifies the cache on completion of usage of that datasegment. Otherwise, the DSM agent does not send that data segment withthe response, signifying the remote storage access component to readthat data segment from disk, and also transfers ownership of that datasegment to the remote DSM agent. In addition, if ownership of arequested data segment is transferred to the remote DSM agent in thiscontext, and that data segment is in the local cache and marked asmodified, then it is flushed to disk, also clearing its modificationmark.

The DSM component, beyond granting the required permissions on disk datasegments, also instructs the storage access component on the appropriatemethod to obtain the latest contents of a data segment being accessed.As previously mentioned, there are three possibilities in this context.The first is that the contents of the data segment in the local cache,if it exists, is latest. The second is that the latest contents of thedata segment is provided by the DSM component via communication with theremote DSM agent. The third is that the latest data segment contentsshould be read from disk. To determine the appropriate method forobtaining the latest contents of a data segment, a procedure 400 (FIGS.18A-B) determines whether the following conditions are true:

-   -   If ownership of the data segment is determined 401 to be local        and it is determined that 402 there is no valid permission on        the data segment, then the data segment should be read from the        disk 403, and the process ends 409. If, on the other hand, there        is a valid permission on the data segment (shared or exclusive),        then the data segment's contents in the local cache, if it        exists, is latest 404.    -   If ownership of the data segment is determined 401 to be remote,        then the following conditions apply. If the request is        determined 405 to be for shared permission and the current        permission on the data segment is shared and the data segment        exists in the local cache, then the data segment's contents in        the local cache is latest 404. In any other case, a request        message is sent 406 to the owner of the data segment (i.e. the        remote DSM agent), and the data segment's latest contents is        either transported within the response if it is determined 407        to be in the remote cache and with a valid permission, otherwise        the data segment's latest contents should be read from disk 403.

To increase efficiency of the file system operations, caching integratedwith DSM may be used for both user data and file system metadata.Therefore, the aforementioned procedures may be employed for efficientdisk access also by the internal procedures of the file systemcomponents. To further improve efficiency, the file system metadata maybe partitioned into regions (see regions 321 a and 321 b in FIG. 13),which are assigned to each of the clustered file system agents, suchthat each region is modified by a single file system agent morefrequently relative to other file system agents. Such a partitionalleviates contention on frequently accessed data segments and reducesmessaging traffic for coordination of access.

B-4. Summary of CFS Caching Method

There has been described an efficient method embodiment for caching,guaranteeing cache coherency, for clustered file systems. In contrast toexisting methods, the present caching method provides good performancein an environment of intensive access patterns to shared files. Themethod achieves cache coherency based on a resolution of fixed orvariable sized and relatively small data segments, rather than files. Inthis way cache coherency is disassociated from the concept of files.Coordination between the distributed caches (including invalidation ofsegments), their coherency and concurrency management, are all donebased on the granularity of data segments rather than files. Theclustered file system utilizes the distributed shared memory technologypreviously described, for cache management. With the present method,when a user writes to a file, only the affected data segments areinvalidated in the other caches, thus tightly bounding the modifiedregions. Consequently, the present embodiment increases the probabilityof cache hits, and maintains high efficiency in situations of intensiveaccess patterns to shared files.

B-5. System, Method and Computer Program Product

As will be appreciated by one skilled in the art, the present inventionmay be embodied as a system, method or computer program product.Accordingly, unless specified to the contrary, the present invention maytake the form of an entirely hardware embodiment, an entirely softwareembodiment (including firmware, resident software, micro-code, etc.) oran embodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, the present invention may take the form of a computerprogram product embodied in any tangible medium of expression havingcomputer-usable program code embodied in the medium.

Any combination of one or more computer-usable or computer-readablemedium(s) may be utilized, unless specified to the contrary herein. Thecomputer-usable or computer-readable medium may be, for example but notlimited to, electronic, magnetic, optical, electromagnetic, infrared, orsemiconductor. More specific examples (a non-exhaustive list) include: aportable computer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), an optical fiber, a portable compact disc read-onlymemory (CDROM), an optical storage device.

Computer program code for carrying out operations of the presentinvention may be written in any combination of one or more programminglanguages, including an object oriented programming language such asJava, Smalltalk, C++ or the like and conventional procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The program code may execute entirely on a user's computer,partly on the user's computer, as a stand-alone software package, partlyon a user's computer and partly on a remote computer or entirely on theremote computer or server. In the latter scenario, the remote computermay be connected to the user's computer through any type of network,including a local area network (LAN) or a wide area network (WAN), orthe connection may be made to an external computer (for example, throughthe Internet using an Internet Service Provider).

The present invention is described above with reference to flowchartillustrations and/or block diagrams of methods, apparatus (systems) andcomputer program products according to embodiments of the invention. Itwill be understood that each block of the flowchart illustrations and/orblock diagrams, and combinations of blocks in the flowchartillustrations and/or block diagrams, can be implemented by computerprogram instructions. These computer program instructions may beprovided to a processor of a general purpose computer, special purposecomputer, or other programmable data processing apparatus to produce amachine, such that the instructions, which execute via the processor ofthe computer or other programmable data processing apparatus, createmeans for implementing the functions/acts specified in the flowchartand/or block diagram block or blocks.

These computer program instructions may also be stored in acomputer-readable medium that can direct a computer or otherprogrammable data processing apparatus to function in a particularmanner, such that the instructions stored in the computer-readablemedium produce an article of manufacture including instruction meanswhich implement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams illustrate the architecture,functionality, and operation of possible implementations of systems,methods and computer program products according to various embodimentsof the present invention. In this regard, each block in the flowchart orblock diagrams may represent a module, segment, or portion of code,which comprises one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions noted in the block may occurout of the order noted in the figures. For example, two blocks shown insuccession may, in fact, be executed substantially concurrently, or theblocks may sometimes be executed in the reverse order, depending uponthe functionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts, or combinations of special purpose hardware andcomputer instructions.

By way of example only, the described embodiments of the DSM may beimplemented on any cluster of x86_(—)64 processor based servers, eachhaving its own RAM and the servers connected via a Gbit Ethernet networkusing two Gbit Ethernet switches such that each server is connected toeach of the switches. By way of example only, the described embodimentsof the CFS may be implemented on any cluster of x86_(—)64 processorbased servers, each having its own cache (RAM) and sharing an externalstorage device. The ratio of cache size versus disk size may be tuned inorder to achieve a desired level of performance, such that increasingthe cache size relative to the disk size enables to increase cache hitsand thus increase performance. An example of hardware configuration,enabling implementation of an enterprise class solution providingsustained high performance, utilizes x86_(—)64 processor based serverswith 32GB RAM each, and a standard external disk array, e.g. IBM DS8000,of 1PB.

Modifications can be made to the previously described embodiments of thepresent invention and without departing from the scope of the invention,the embodiments being illustrative and not restrictive.

1. A method comprising: providing a clustered file system (CFS) residingon a cluster of nodes for accessing a shared storage of file systemdata; providing a local cache memory on each node to reduce file systemaccess to the shared storage; providing a distributed shared memory(DSM) agent on each node which DSM agents collectively manage accesspermissions to the entire space of file system data as data segments andwhich agents utilize the distributed cache memories as a virtual sharedcache.
 2. The method of claim 1, wherein: the DSM agents determine thelatest contents of file system data to maintain coherency between thedistributed cache memories of the CFS.
 3. The method of claim 2,wherein: in response to a user request to a local node, user operationsare applied to data segments in the associated local cache memory,including reading requested data segments to the local cache memory andmodifying data segments within the local cache memory, in accordancewith permissions granted by the DSM agents.
 4. The method of claim 3,wherein: users performing read only operations are allowed to access thefile system data concurrently, while the operations of users thatrequire access for modification of a same data segment are serialized.5. The method of claim 1, wherein: each node has a CFS agent formaintaining a local set of data segments in the local cache memory andassociated local parameters which include an access permission andownership by the local DSM agent.
 6. The method of claim 1, wherein upona user's request for allocating a new data segment, the DSM agentsgranting an exclusive access permission on the allocated data segment inthe shared storage.
 7. The method of claim 1, including: upon a user'srequest for de-allocating a data segment, and prior to thede-allocation, the DSM agents granting an exclusive access permission onthe de-allocated data segment in the shared storage, and subsequent tode-allocation, the DSM agents releasing the data segment.
 8. The methodof claim 1, wherein: upon a user's request for accessing a data segment,the DSM agents granting the user an access permission on the datasegment, and prior to that the DSM agents being informed on theexistence of the data segment contents in the cache memory.
 9. Themethod of claim 8, including: following grant of the access permission,the DSM agent instructing the respective local cache memory on how toobtain the latest contents of the data segment.
 10. The method of claim9, including: the DSM agent instructing the respective local cachememory to obtain the latest contents of the data segment from one of:the local cache memory; the remote cache memory via communication of thelocal DSM agent with a remote DSM agent; the shared storage.
 11. Themethod of claim 10, wherein: if the DSM agent instructs the local cachememory to obtain the latest contents of the data segment from the sharedstorage, reading the data segment from the shared storage; and if theDSM agent instructs the local cache memory to obtain the latest contentsof the data segment from the local cache memory, but the data segment isnot found present in the local cache memory, reading the data segmentfrom the shared storage; and if the DSM agent instructs the local cachememory to obtain the latest contents of the data segment from the localcache memory, and the data segment is found present in the local cachememory, obtaining the data segment from the local cache memory; and ifthe DSM agent provides to the local cache memory the latest contents ofthe data segment from the remote cache memory, using the provided datasegment.
 12. The method of claim 10, including: one DSM agent sendingthe latest contents to the other DSM agent.
 13. The method of claim 8,including: upon a user's request for releasing a data segment, the DSMagents releasing the data segment.
 14. The method of claim 9, wherein:the DSM agents determine the latest contents of a data segment requestedby a user by: if ownership of the data segment is with the local agentand there is no valid access permission on that data segment, then thedata segment should be read from the shared storage; if ownership of thedata segment is with the local agent and there is a valid permission onthe data segment (shared or exclusive), then the data segment contentsin the local cache memory, if it exists, is the latest; if ownership ofthe data segment is with the remote agent and the request is for sharedpermission and the local permission on the data segment is shared andthe data segment exists in the local cache memory, then the data segmentcontents in the local cache memory is the latest; and if ownership ofthe data segment is with the remote agent and the previous conditiondoes not apply, then a request message is sent to the remote DSM agentand the data segment latest contents is either transported with aresponse if it is in the remote cache memory and with a validpermission, otherwise the data segment latest contents should be readfrom the shared storage.
 15. The method of claim 1, wherein: the DSMagents determine the latest contents of a data segment by: uponprocessing a request from a remote DSM agent for a data segment, a localDSM agent determines whether the requested data segment contents existsin local cache memory; and if the requested data segment contents existsin the local cache memory and the local DSM agent holds a validpermission on that data segment, then the local DSM agent obtains itfrom the local cache memory and sends it with a response to the remoteDSM agent, and then informs the local cache memory on completion ofusage of the data segment; and otherwise the local DSM agent does notsend that data segment with the response, signifies the remote cachememory to read that data segment from the shared storage, and transfersownership of that data segment to the remote DSM agent.
 16. The methodof claim 15, wherein: upon transferring ownership of a data segment to aremote DSM agent, and if the requested data segment contents exists inthe local cache memory and it is marked as modified, then the local DSMagent instructs the local cache memory to flush the data segmentcontents to the shared storage, and clears the modification mark of thatdata segment.
 17. The method of claim 1, including: the shared storageincludes file system metadata and file system user data, and the cachememories operating as a virtual shared cache for both the file systemmetadata and file system user data.
 18. The method of claim 1,including: partitioning the file system metadata into regions, which areassigned to each of the agents, such that each region is modified by asingle agent more frequently relative to other agents.
 19. The method ofclaim 1, wherein: the CFS has two DSM agents each residing on adifferent one of two nodes.
 20. A computer program product for managingaccess in a clustered file system (CFS) to a shared storage of filesystem data, each node of the CFS having a local cache memory, thecomputer program product comprising: a computer usable medium havingcomputer usable program code embodied therewith, the computer usablecode comprising: computer usable program code configured to provide adistributed shared memory (DSM) agent on each node; computer usableprogram code configured to enable the DSM agents to collectively manageaccess permissions to the entire space of file system data as datasegments using the distributed cache memories of the clustered nodes asa virtual shared cache.
 21. The computer program product of claim 20,further comprising: computer usable program code configured to enablethe DSM agents to determine the latest contents of file system data tomaintain coherency between the distributed cache memories of the CFS.22. The computer program product of claim 21, further comprising:computer usable program code configured to, in response to a userrequest to a local node, applying user operations to data segments inthe associated local cache memory, including reading requested datasegments to the local cache memory and modifying data segments withinthe local cache memory, in accordance with permissions granted by theDSM agents.
 23. The computer program product of claim 22, furtherincluding: computer usable program code configured to enable users thatperform read only operations access to the file system dataconcurrently, while the operations of users that require access formodification of a same data segment are serialized.
 24. The computerprogram product of claim 20, further including: computer usable programcode configured to provide each node with a CFS agent for maintaining alocal set of data segments in the local cache memory and associatedlocal parameters which include an access permission and ownership by oneof the DSM agents.
 25. The computer program product of claim 20, furtherincluding: computer usable program code configured to, upon a user'srequest for allocating a new data segment, the DSM agents granting anexclusive access permission on the allocated data segment in the sharedstorage.
 26. The computer program product of claim 20, furtherincluding: computer usable program code configured to, upon a user'srequest for de-allocating a data segment, and prior to thede-allocation, the DSM agents granting an exclusive access permission onthe de-allocated data segment in the shared storage, and subsequent tode-allocation, the DSM agents releasing the data segment.
 27. Thecomputer program product of claim 20, further including: computer usableprogram code configured to, upon a user's request for accessing a datasegment, the DSM agents granting the user an access permission on thedata segment, and prior to that the DSM agents being informed on theexistence of the data segment contents in the cache memory.
 28. Thecomputer program product of claim 27, further including: computer usableprogram code configured to, following grant of the access permission,the DSM agent instructing the respective local cache memory on how toobtain the latest contents of the data segment.
 29. The computer programproduct of claim 28, further including: computer usable program codeconfigured to enable the local DSM agent to instruct the local cachememory to obtain the latest contents of the data segment from one of:the local cache memory; the remote cache memory via communication of thelocal DSM agent with a remote DSM agent; the shared storage.
 30. Thecomputer program product of claim 27, further including: computer usableprogram code configured to, upon a user's request for releasing a datasegment, release the data segment.
 31. The computer program product ofclaim 20, further including: computer usable program code configured to,upon transferring ownership of a data segment to a remote DSM agent, andif the requested data segment contents exists in the local cache memoryand it is marked as modified, then the local DSM agent instructs thelocal cache memory to flush the data segment contents to the sharedstorage, and clears the modification mark of that data segment.
 32. Thecomputer program product of claim 20, further including: computer usableprogram code configured to, where the shared storage includes filesystem metadata and file system user data, the cache memories operatingas a virtual shared cache for both the file system metadata and filesystem user data.
 33. The computer program product of claim 32, furtherincluding: computer usable program code configured to partition the filesystem metadata into regions, which are assigned to each of the agents,such that each region is modified by a single agent more frequentlyrelative to other agents.
 34. The computer program product of claim 20,further including: computer usable program code configured to providethe CFS with two DSM agents each residing on a different one of twonodes.
 35. A system comprising: a clustered file system (CFS) includingplurality of nodes forming a computer cluster, each node having aprocessor and a local cache memory coupled to the processor, and eachnode being in communication with a shared storage of file system data;wherein the processor and the memory are configured to perform a methodcomprising: providing a distributed shared memory (DSM) agent on eachnode which DSM agents collectively manage access permissions to theentire space of file system data as data segments and which agentsutilize the distributed cache memories as a virtual shared cache. 36.The system of claim 35, wherein the processor and the memory are furtherconfigured to perform a method comprising: the DSM agents determine thelatest contents of file system data to maintain coherency between thedistributed cache memories of the CFS.
 37. The system of claim 36,wherein the processor and the memory are further configured to perform amethod comprising: in response to a user request to a local node, useroperations are applied to data segments in the associated local cachememory, including reading requested data segments to the local cachememory and modifying data segments within the local cache memory, inaccordance with permissions granted by the DSM agents.
 38. The system ofclaim 37, wherein the processor and the memory are further configured toperform a method comprising: users performing read only operations areallowed to access the file system data concurrently, while theoperations of users that require access for modification of a same datasegment are serialized.
 39. The system of claim 35, wherein theprocessor and the memory are further configured to perform a methodcomprising: each node has a CFS agent for maintaining a local set ofdata segments in the local cache memory and associated local parameterswhich include an access permission and ownership by the local DSM agent.40. The system of claim 35, wherein the processor and the memory arefurther configured to perform a method comprising: upon a user's requestfor allocating a new data segment, the DSM agents granting an exclusiveaccess permission on the allocated data segment in the shared storage.41. The system of claim 35, wherein the processor and the memory arefurther configured to perform a method comprising: upon a user's requestfor de-allocating a data segment, and prior to the de-allocation, theDSM agents granting an exclusive access permission on the de-allocateddata segment in the shared storage, and subsequent to de-allocation, theDSM agents releasing the data segment.
 42. The system of claim 35,wherein the processor and the memory are further configured to perform amethod comprising: upon a user's request for accessing a data segment,the DSM agents granting the user an access permission on the datasegment, and prior to that the DSM agents being informed on theexistence of the data segment contents in the cache memory.
 43. Thesystem of claim 42, wherein the processor and the memory are furtherconfigured to perform a method comprising: following grant of the accesspermission, the DSM agent instructing the respective local cache memoryon how to obtain the latest contents of the data segment.
 44. The systemof claim 35, wherein the processor and the memory are further configuredto perform a method comprising: where the shared storage includes filesystem metadata and file system user data, the cache memories operatingas a virtual shared cache for both the file system metadata and filesystem user data.
 45. The system of claim 35, wherein the processor andthe memory are further configured to perform a method comprising:partitioning the file system metadata into regions, which are assignedto each of the agents, such that each region is modified by a singleagent more frequently relative to other agents.